import { Column, Entity, Index, PrimaryGeneratedColumn } from "typeorm";
import { UserStatus } from "../dto/user.dto";

@Entity()
export class UserEntity{
    @PrimaryGeneratedColumn({type:'int',name:'id',comment:"用户自增id"})
    id:number;

    @Index('login-username')
    @Column('varchar',{length:64,name:'username',comment:'用户名'})
    username:string;

    @Column('varchar',{length:64,comment:'用户密码',name:'password',nullable:true})
    password:string|null;

    @Column({type:'int8',comment:"用户状态",default:UserStatus.NORMAL})
    status:number;

    @Column({type:'int',comment:'注册时间戳'})
    regtime:number;

    @Column({type:'int',comment:'最后登录时间戳'})
    lasttime:number;
}